package com.ruoyi.board.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.board.domain.StockBoardIndustryHistEm;
import com.ruoyi.board.service.IStockBoardIndustryHistEmService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 东方财富-指数-日频Controller
 * 
 * @author leng.xz
 * @date 2024-05-17
 */
@Controller
@RequestMapping("/board/IndustryHistEm")
public class StockBoardIndustryHistEmController extends BaseController
{
    private String prefix = "board/IndustryHistEm";

    @Autowired
    private IStockBoardIndustryHistEmService stockBoardIndustryHistEmService;

    @RequiresPermissions("board:IndustryHistEm:view")
    @GetMapping()
    public String IndustryHistEm()
    {
        return prefix + "/IndustryHistEm";
    }

    /**
     * 查询东方财富-指数-日频列表
     */
    @RequiresPermissions("board:IndustryHistEm:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(StockBoardIndustryHistEm stockBoardIndustryHistEm)
    {
        startPage();
        List<StockBoardIndustryHistEm> list = stockBoardIndustryHistEmService.selectStockBoardIndustryHistEmList(stockBoardIndustryHistEm);
        return getDataTable(list);
    }

    /**
     * 导出东方财富-指数-日频列表
     */
    @RequiresPermissions("board:IndustryHistEm:export")
    @Log(title = "东方财富-指数-日频", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(StockBoardIndustryHistEm stockBoardIndustryHistEm)
    {
        List<StockBoardIndustryHistEm> list = stockBoardIndustryHistEmService.selectStockBoardIndustryHistEmList(stockBoardIndustryHistEm);
        ExcelUtil<StockBoardIndustryHistEm> util = new ExcelUtil<StockBoardIndustryHistEm>(StockBoardIndustryHistEm.class);
        return util.exportExcel(list, "IndustryHistEm");
    }

    /**
     * 新增东方财富-指数-日频
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存东方财富-指数-日频
     */
    @RequiresPermissions("board:IndustryHistEm:add")
    @Log(title = "东方财富-指数-日频", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(StockBoardIndustryHistEm stockBoardIndustryHistEm)
    {
        return toAjax(stockBoardIndustryHistEmService.insertStockBoardIndustryHistEm(stockBoardIndustryHistEm));
    }

    /**
     * 修改东方财富-指数-日频
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        StockBoardIndustryHistEm stockBoardIndustryHistEm = stockBoardIndustryHistEmService.selectStockBoardIndustryHistEmById(id);
        mmap.put("stockBoardIndustryHistEm", stockBoardIndustryHistEm);
        return prefix + "/edit";
    }

    /**
     * 修改保存东方财富-指数-日频
     */
    @RequiresPermissions("board:IndustryHistEm:edit")
    @Log(title = "东方财富-指数-日频", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(StockBoardIndustryHistEm stockBoardIndustryHistEm)
    {
        return toAjax(stockBoardIndustryHistEmService.updateStockBoardIndustryHistEm(stockBoardIndustryHistEm));
    }

    /**
     * 删除东方财富-指数-日频
     */
    @RequiresPermissions("board:IndustryHistEm:remove")
    @Log(title = "东方财富-指数-日频", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(stockBoardIndustryHistEmService.deleteStockBoardIndustryHistEmByIds(ids));
    }
}
